package ca.ubc.icapture.genapha.forms;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;

import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMessage;


public class SnpRatioTestForm   extends ActionForm {
    private String[] geneIDs;
    private String cutoff;
    private String permutations;
    private String pathwayName;
    
    private String submitType;
    private String selectedPhenotype;

    
    public SnpRatioTestForm(){
        super();
    }
    
    @Override
    public void reset(ActionMapping mapping, HttpServletRequest request) {

    }

    @Override
    public ActionErrors validate( ActionMapping mapping, HttpServletRequest request ) {
       ActionErrors errors = new ActionErrors();
       if (submitType!=null && getSubmitType().equalsIgnoreCase("Analyze")){
            if(cutoff==null || cutoff.length()==0){
                errors.add("cutoff",new ActionMessage("error.entry.required"));
            }
            if(permutations==null || permutations.length()==0){
                errors.add("permutations",new ActionMessage("error.entry.required"));
            }
       }
       return errors;
    }

    public String getSubmitType() {
        return submitType;
    }

    public void setSubmitType(String submitType) {
        this.submitType = submitType;
    }

    
    public String getSelectedPhenotype() {
        return selectedPhenotype;
    }

    public void setSelectedPhenotype(String selectedPhenotype) {
        this.selectedPhenotype = selectedPhenotype;
    }

    

    /**
     * @return the geneIDs
     */
    public String[] getGeneIDs() {
        return geneIDs;
    }

    /**
     * @param geneIDs the geneIDs to set
     */
    public void setGeneIDs(String[] geneIDs) {
        this.geneIDs = geneIDs;
    }

    /**
     * @return the cutoff
     */
    public String getCutoff() {
        return cutoff;
    }

    /**
     * @param cutoff the cutoff to set
     */
    public void setCutoff(String cutoff) {
        this.cutoff = cutoff;
    }

    /**
     * @return the cutoff
     */
    public String getPermutations() {
        return permutations;
    }

    /**
     * @param cutoff the cutoff to set
     */
    public void setPermutations(String permutations) {
        this.permutations = permutations;
    }

    /**
     * @return the pathwayName
     */
    public String getPathwayName() {
        return pathwayName;
    }

    /**
     * @param pathwayName the pathwayName to set
     */
    public void setPathwayName(String pathwayName) {
        this.pathwayName = pathwayName;
    }
       
    

}